import request from '@/utils/request'

// 创建仓库出/入库任务
export function createOrderTask(data) {
  return request({
    url: '/warehouse/order-task/create',
    method: 'post',
    data: data
  })
}

// 更新仓库出/入库任务
export function updateOrderTask(data) {
  return request({
    url: '/warehouse/order-task/update',
    method: 'put',
    data: data
  })
}

// 删除仓库出/入库任务
export function deleteOrderTask(id) {
  return request({
    url: '/warehouse/order-task/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除仓库出/入库任务 */
export function deleteOrderTaskList(ids) {
  return request({
    url: `/warehouse/order-task/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得仓库出/入库任务
export function getOrderTask(id) {
  return request({
    url: '/warehouse/order-task/get?id=' + id,
    method: 'get'
  })
}

// 获得仓库出/入库任务分页
export function getOrderTaskPage(params) {
  return request({
    url: '/warehouse/order-task/page',
    method: 'get',
    params
  })
}
// 导出仓库出/入库任务 Excel
export function exportOrderTaskExcel(params) {
  return request({
    url: '/warehouse/order-task/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}


// 完结任务
export function finish(data) {
  return request({
    url: '/warehouse/order-task/finish',
    method: 'put',
    data: data
  })
}

// 取消任务
export function clear(data) {
  return request({
    url: '/warehouse/order-task/clear',
    method: 'put',
    data: data
  })
}
